package com.wlts.wzy.Base;

import com.wlts.wzy.Result.Result;
import com.wlts.wzy.expand.MyPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Wuzhiyong
 * on 2019-02-22 11:29
 */
@RestController
public interface IBaseController<T extends BaseEntity,P extends BasePageParam> {

    @ApiOperation(value = "增加")
    @RequestMapping(value = "/addEntity", method = RequestMethod.POST)
    Result<T> addEntity(@RequestBody T t);

    @ApiOperation(value = "删除")
    @RequestMapping(value = "/delById", method = RequestMethod.POST)
    Result<T> delById(@RequestBody BaseIdParam t);

    @ApiOperation(value = "修改")
    @RequestMapping(value = "/chaEntity", method = RequestMethod.POST)
    Result<T> chaEntity(@RequestBody T t);

    @ApiOperation(value = "id查询")
    @RequestMapping(value = "/getById", method = RequestMethod.POST)
    Result<T> getById(@RequestBody BaseIdParam t);

    @ApiOperation(value = "分页查询")
    @RequestMapping(value = "/getPage", method = RequestMethod.POST)
    Result<MyPage<T>> getPage(@RequestBody P p);


}
